package web;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import dto.echarts.Option;
import entity.Admin;
import enums.travelenums;
import service.Echarts_service;

@Controller
public class Echarts_controller {
	@Autowired
	private Echarts_service echarts_service;
	
	@RequestMapping(value="oderreport", method = RequestMethod.GET)
	@ResponseBody
	public Option OderReport(){
		return echarts_service.countOrder();
	}
	
	@RequestMapping(value="report", method = RequestMethod.POST)
	public String Report(HttpSession session){
		Admin admin=(Admin)session.getAttribute("admin");
		if(admin!=null){
			return "back/report";
		}
		return travelenums.NOLOGIN.getInfo();
	}
}
